package org.link.util;

import org.link.bean.IpInfo;
import org.springframework.core.convert.converter.Converter;

/**
 * 
 * project_name:springlearn
 * package_name:org.link.util
 * file_name:IpUtil.java
 * @author Link
 * create_date:2015年11月17日 下午2:35:02
 * modified_date:
 * description:ip地址转换类
 *
 */
public class IpUtil implements Converter<String, IpInfo>{

	@Override
	public IpInfo convert(String ip) {
		String[] ip1 = ip.split(".");
		IpInfo ipInfo = new IpInfo(Integer.parseInt(ip1[0]), Integer.parseInt(ip1[1]), Integer.parseInt(ip1[2]), Integer.parseInt(ip1[3]));
		System.out.println(ipInfo);
		return ipInfo;
	}

}
